from django import forms
from .models import Comment

class CommentForm(forms.ModelForm):
    class Meta:
        model = Comment
        fields = ['content', 'parent']  # parent 用于回复功能（可选）
        widgets = {
            'content': forms.Textarea(attrs={
                'rows': 3,
                'placeholder': '请输入评论内容...'
            }),
            'parent': forms.HiddenInput()  # 回复时隐藏父评论ID
        }